:root {
  --bg-color: #1e1e1e;
  --chat-bg-color: #2d2d2d;
  --message-bg-color: #3c3c3c;
  --user-message-bg-color: #4a4a7a;
  --input-bg-color: #3c3c3c;
  --border-color: #4a4a4a;
  --text-color: #dcdcdc;
  --text-color-light: #b0b0b0;
  --accent-color-blue: #3a96f7;
  --accent-color-grey: #5a5a5a;
  --accent-color-red: #e74c3c;
  --accent-color-orange: #e67e22;
  --accent-color-orange-hover: #d35400;
  --code-bg-color: #252525;
  --user-avatar-bg: #6c5ce7;
  --ai-avatar-bg: #00cec9;
  --system-avatar-bg: #fab1a0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  min-height: 100vh;
  font-size: 14px;
}
.mobile-frame {
  width: 100%;
  height: 100vh;
  background-color: var(--chat-bg-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  padding: 10px 20px;
  font-weight: bold;
  color: var(--text-color-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.header-icons span {
  margin-left: 15px;
  font-size: 18px;
  cursor: pointer;
}
.header-icons .new-chat-button {
  font-size: 22px;
}
.chat-body {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
}
.message-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
}
.message-group.user {
  align-self: flex-end;
  max-width: 100%;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
}
.message-group.user .message-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.message-group.ai {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 100%;
  width: 100%;
}
.message-group.system {
  width: 100%;
  align-items: flex-start;
}
.message-sender {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  color: var(--text-color-light);
  font-size: 15px;
  position: relative;
}
.message-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}
.message-group:hover .message-actions {
  visibility: visible;
  opacity: 1;
}
.chat-body.request-in-progress .message-actions {
  visibility: hidden;
  opacity: 0;
}
.message-actions button {
  background: none;
  border: none;
  color: var(--text-color-light);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}
.message-actions button svg {
  width: 16px;
  height: 16px;
}
.edit-button:hover {
  color: var(--accent-color-blue);
}
.retry-button:hover {
  color: var(--accent-color-blue);
}
.retry-button:hover svg {
  transition: transform 0.3s ease-in-out;
  transform: rotate(360deg);
}
.delete-button:hover {
  color: var(--accent-color-red);
}
.message-sender .icon,
.message-group > .icon {
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}
.message-group.user .message-sender .icon {
  /* background-color: var(--user-avatar-bg); */
}
.message-group.ai .message-sender .icon {
  background-color: var(--ai-avatar-bg);
}
.message-group.system .message-sender .icon {
  background-color: #4a4a4a;
}
.message-content,
.user-response {
  padding: 12px 16px;
  border-radius: 15px;
  line-height: 1.6;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.message-content {
  background-color: var(--message-bg-color);
}
.message-content > :first-child {
  margin-top: 0;
}
.message-content > :last-child {
  margin-bottom: 0;
}
.user-response {
  background-color: var(--user-message-bg-color);
  color: white;
}

.user-text-block {
  white-space: pre-wrap;
  word-break: break-all;
}
.message-group.user .user-response {
  border-bottom-right-radius: 5px;
}
.message-group.ai .message-content {
  border-bottom-left-radius: 5px;
}
.message-content.task-card {
  background-color: #333;
}
.task-card .task-title {
  font-weight: bold;
}
.task-card .task-meta {
  font-size: 12px;
  color: var(--text-color-light);
  margin-top: 4px;
}
.api-request {
  color: var(--text-color-light);
  cursor: pointer;
  margin-left: 24px;
}
.api-request::before {
  content: '>';
  margin-right: 8px;
  display: inline-block;
  transition: transform 0.2s;
}
.message-options .option {
  background-color: var(--input-bg-color);
  border: 1px solid var(--border-color);
  padding: 10px 15px;
  border-radius: 6px;
  margin-top: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.message-options .option:hover {
  background-color: #4a4a4a;
}
.code-block {
  background-color: var(--code-bg-color);
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  color: #9cdcfe;
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}
.message-content pre {
  margin: 10px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-all;
}
.message-content code.hljs {
  padding: 1em;
  border-radius: 5px;
  display: block;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
}
.tool-call-card {
  background-color: var(--message-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  margin-top: 4px;
}

.tool-call-card.dangerous {
  background-color: rgba(231, 76, 60, 0.1);
  border: 2px solid var(--accent-color-red);
}
.tool-call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background-color: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.tool-name {
  font-weight: bold;
  font-size: 13px;
  color: var(--text-color);
}

.tool-call-card.dangerous .tool-name {
  color: var(--accent-color-red);
  font-weight: 900;
}

.dangerous-command {
  color: var(--accent-color-red);
  font-weight: bold;
}
.toggle-details {
  background: none;
  border: none;
  color: var(--text-color-light);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 16px;
  height: 16px;
}
.tool-status-icon {
  width: 16px;
  height: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: var(--text-color-light);
  cursor: default;
}
.tool-status-icon.success {
  cursor: pointer;
}
.loader {
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top: 2px solid var(--text-color-light);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.tool-call-body {
  padding: 15px;
}
.tool-call-body .code-block {
  padding: 12px;
  font-size: 13px;
}
.chat-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--chat-bg-color);
  flex-shrink: 0;
}
.action-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}
.action-buttons button {
  flex-grow: 1;
  padding: 10px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}
.action-buttons .cmd-button {
  background-color: var(--accent-color-blue);
  color: white;
}
.action-buttons .cmd-button:hover {
  background-color: #2586f5;
}
.action-buttons .reject-button {
  background-color: var(--accent-color-red);
  color: white;
}
.action-buttons .reject-button:hover {
  background-color: #c0392b;
}
.action-buttons .continue-button {
  background-color: var(--accent-color-orange);
  color: white;
}
.action-buttons .continue-button:hover {
  background-color: var(--accent-color-orange-hover);
}
.action-buttons .cancel-button {
  background-color: var(--message-bg-color);
  color: var(--text-color);
  flex-basis: 100%;
}
.action-buttons .cancel-button:hover {
  background-color: #4a4a4a;
}
.input-area {
  display: flex;
  align-items: stretch;
  background-color: var(--input-bg-color);
  border: 1px solid var(--accent-color-blue);
  border-radius: 8px;
  padding: 5px;
  min-height: 80px;
}
.input-area textarea {
  flex-grow: 1;
  background-color: transparent;
  border: none;
  color: var(--text-color);
  font-size: 14px;
  resize: none;
  box-sizing: border-box;
  min-height: 70px;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.input-area textarea:focus {
  outline: none;
}
.input-area textarea::placeholder {
  color: var(--text-color-light);
  opacity: 0.7;
}
.input-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 8px 5px;
}
.icon-button {
  background: none;
  border: none;
  color: var(--text-color-light);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
.icon-button:hover {
  color: var(--text-color);
}
.icon-button.send-button {
  font-size: 24px;
}
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-color-light);
  flex-shrink: 0;
}
.model-select-trigger {
  background-color: var(--message-bg-color);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.model-select-trigger:hover {
  background-color: #4a4a4a;
}
.model-select-popup {
  position: fixed;
  bottom: 50px;
  left: 20px;
  width: 250px;
  background-color: var(--chat-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  padding: 10px;
  display: none;
  flex-direction: column;
}
#model-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  margin-bottom: 10px;
  background-color: var(--input-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
}
.model-options-container {
  max-height: 200px;
  overflow-y: auto;
}
.model-option {
  padding: 10px;
  cursor: pointer;
  border-radius: 4px;
}
.model-option:hover,
.model-option.active {
  background-color: var(--accent-color-blue);
  color: white;
}
.bottom-bar .tags .check-icon {
  color: #82c994;
}
.bottom-bar .bottom-icons {
  font-size: 16px;
}
.bottom-bar .bottom-icons span {
  margin-left: 10px;
}
.chat-body::-webkit-scrollbar {
  width: 8px;
}
.chat-body::-webkit-scrollbar-track {
  background: var(--chat-bg-color);
}
.chat-body::-webkit-scrollbar-thumb {
  background-color: var(--accent-color-grey);
  border-radius: 4px;
  border: 2px solid var(--chat-bg-color);
}
.chat-body::-webkit-scrollbar-thumb:hover {
  background-color: #7a7a7a;
}
.input-area textarea::-webkit-scrollbar {
  display: none;
}
.settings-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.settings-popup-content {
  background-color: var(--chat-bg-color);
  border-radius: 0;
  width: 100%;
  height: 100%;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-popup-content iframe {
  flex-grow: 1;
  border: none;
  width: 100%;
  height: 100%;
}
.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: var(--text-color-light);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  z-index: 10;
}
.close-button:hover {
  color: var(--text-color);
}
#image-preview-container {
  padding-bottom: 10px;
}
#image-preview-container::-webkit-scrollbar {
  height: 6px;
}
#image-preview-container::-webkit-scrollbar-track {
  background: transparent;
}
#image-preview-container::-webkit-scrollbar-thumb {
  background-color: var(--accent-color-grey);
  border-radius: 3px;
}
#image-preview-container::-webkit-scrollbar-thumb:hover {
  background-color: #7a7a7a;
}
#image-preview-container > div {
  margin-right: 8px;
}
.chat-history {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}
.history-item:hover {
  background-color: var(--message-bg-color);
}
.history-item-info {
  flex-grow: 1;
  overflow: hidden;
  margin-right: 15px;
  display: flex;
  flex-direction: column;
}
.history-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-timestamp {
  font-size: 12px;
  color: var(--text-color-light);
  margin-top: 4px;
}
.history-item-actions button {
  background: none;
  border: none;
  color: var(--text-color-light);
  cursor: pointer;
  font-size: 18px;
  margin-left: 10px;
}
.history-item-actions button:hover {
  color: var(--accent-color-red);
}
.chat-history::-webkit-scrollbar {
  width: 8px;
}
.chat-history::-webkit-scrollbar-track {
  background: var(--chat-bg-color);
}
.chat-history::-webkit-scrollbar-thumb {
  background-color: var(--accent-color-grey);
  border-radius: 4px;
  border: 2px solid var(--chat-bg-color);
}
.chat-history::-webkit-scrollbar-thumb:hover {
  background-color: #7a7a7a;
}
.tags {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tag-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background-color: var(--message-bg-color);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: default;
  margin-left: 8px;
}
#online-status {
  cursor: pointer;
}
#online-status .icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}
#online-status .error-icon {
  background-color: var(--accent-color-red);
}
#online-status .error-icon::before,
#online-status .error-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 1.5px;
  background-color: white;
  transform-origin: center;
}
#online-status .error-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
#online-status .error-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.status-text {
  font-size: 12px;
  color: var(--text-color-light);
}
#online-status .success-icon {
  background-color: #2ecc71;
}
#token-usage .icon {
  width: 12px;
  height: 12px;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.token-text {
  font-size: 12px;
  color: var(--text-color-light);
}
@keyframes rainbow-background-animation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
.path-value {
  font-weight: bold;
  color: rgb(145, 255, 0) !important;
  border-radius: 6px;
  background: linear-gradient(90deg, #af01ff, #0000ff, #4b0082, #8b00ff);
  background-size: 400% 400%;
  animation: rainbow-background-animation 10s linear infinite;
}
#compression-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  z-index: 10000;
  pointer-events: auto;
}
.compression-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.4s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 10001;
}
.compression-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.compression-icon {
  width: 24px;
  height: 24px;
  position: relative;
  flex-shrink: 0;
}
.compression-icon::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 21px solid #ffd700;
  top: 0;
  left: 0;
}
.compression-icon::after {
  content: '!';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #333;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
}
.compression-header h3 {
  color: white;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.compression-progress {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 15px;
}
.progress-bar {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(79, 172, 254, 0.8);
}
.progress-text {
  color: white;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.message-group.compressing {
  position: relative;
}
.message-group.compressing .message-content,
.message-group.compressing .user-response {
  position: relative;
  overflow: hidden;
}
.message-group.compressing .message-content::after,
.message-group.compressing .user-response::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(102, 126, 234, 0.6) 50%, transparent 100%);
  animation: scannerSweep 0.8s ease-out;
  pointer-events: none;
  z-index: 1;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes scannerSweep {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}
@keyframes compress {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.85);
  }
}
@keyframes pulseHighlight {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(102, 126, 234, 0);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(102, 126, 234, 0);
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
